package biz.obake.team.touchprotector.lfd;

import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import biz.obake.team.touchprotector.g.a;
import biz.obake.team.touchprotector.lfd.c;

public class f {
    private static f f;

    /* renamed from: a  reason: collision with root package name */
    private String f1747a;

    /* renamed from: b  reason: collision with root package name */
    private boolean f1748b;

    /* renamed from: c  reason: collision with root package name */
    private Drawable f1749c;

    /* renamed from: d  reason: collision with root package name */
    private String f1750d;
    private String e;

    /* JADX WARNING: Code restructure failed: missing block: B:11:0x0060, code lost:
        if (r6.f1750d != null) goto L_0x0062;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:20:0x0099, code lost:
        if (r6.f1750d != null) goto L_0x0062;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void a() {
        /*
            r6 = this;
            boolean r0 = r6.f1748b
            if (r0 == 0) goto L_0x0005
            return
        L_0x0005:
            java.lang.String r0 = "lock_frame_design"
            java.lang.String r0 = biz.obake.team.touchprotector.g.a.l(r0)
            java.lang.String r1 = "preset:0"
            boolean r1 = r1.equals(r0)
            r2 = 2131624046(0x7f0e006e, float:1.887526E38)
            r3 = 0
            r4 = 1
            if (r1 == 0) goto L_0x002f
            r0 = 0
            r6.f1749c = r0
            biz.obake.team.touchprotector.lfd.e r0 = biz.obake.team.touchprotector.lfd.e.d()
            java.lang.String r0 = r0.c(r3)
            r6.f1750d = r0
            java.lang.String r0 = biz.obake.team.touchprotector.c.w(r2)
            r6.e = r0
            r6.f1748b = r4
            goto L_0x00cf
        L_0x002f:
            java.lang.String r1 = "preset:"
            boolean r1 = r0.startsWith(r1)
            if (r1 == 0) goto L_0x0066
            r1 = 7
            java.lang.String r0 = r0.substring(r1)
            int r0 = java.lang.Integer.parseInt(r0)
            biz.obake.team.touchprotector.lfd.e r1 = biz.obake.team.touchprotector.lfd.e.d()
            android.graphics.drawable.Drawable r1 = r1.b(r0)
            r6.f1749c = r1
            biz.obake.team.touchprotector.lfd.e r1 = biz.obake.team.touchprotector.lfd.e.d()
            java.lang.String r0 = r1.c(r0)
            r6.f1750d = r0
            java.lang.String r0 = biz.obake.team.touchprotector.c.w(r2)
            r6.e = r0
            android.graphics.drawable.Drawable r0 = r6.f1749c
            if (r0 == 0) goto L_0x0063
            java.lang.String r0 = r6.f1750d
            if (r0 == 0) goto L_0x0063
        L_0x0062:
            r3 = 1
        L_0x0063:
            r6.f1748b = r3
            goto L_0x00cf
        L_0x0066:
            java.lang.String r1 = "custom:"
            boolean r1 = r0.startsWith(r1)
            if (r1 == 0) goto L_0x009c
            biz.obake.team.touchprotector.lfd.b r1 = biz.obake.team.touchprotector.lfd.b.i()
            int r0 = r1.g(r0)
            biz.obake.team.touchprotector.lfd.b r1 = biz.obake.team.touchprotector.lfd.b.i()
            android.graphics.drawable.Drawable r1 = r1.b(r0)
            r6.f1749c = r1
            biz.obake.team.touchprotector.lfd.b r1 = biz.obake.team.touchprotector.lfd.b.i()
            java.lang.String r0 = r1.c(r0)
            r6.f1750d = r0
            r0 = 2131624041(0x7f0e0069, float:1.887525E38)
            java.lang.String r0 = biz.obake.team.touchprotector.c.w(r0)
            r6.e = r0
            android.graphics.drawable.Drawable r0 = r6.f1749c
            if (r0 == 0) goto L_0x0063
            java.lang.String r0 = r6.f1750d
            if (r0 == 0) goto L_0x0063
            goto L_0x0062
        L_0x009c:
            java.lang.String r1 = ":"
            r5 = 2
            java.lang.String[] r0 = r0.split(r1, r5)     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r1 = r0[r3]     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r0 = r0[r4]     // Catch:{ NameNotFoundException | b -> 0x0063 }
            biz.obake.team.touchprotector.lfd.c r5 = new biz.obake.team.touchprotector.lfd.c     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r5.<init>(r1)     // Catch:{ NameNotFoundException | b -> 0x0063 }
            int r0 = r5.i(r0)     // Catch:{ NameNotFoundException | b -> 0x0063 }
            android.graphics.drawable.Drawable r1 = r5.b(r0)     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r6.f1749c = r1     // Catch:{ NameNotFoundException | b -> 0x0063 }
            java.lang.String r0 = r5.c(r0)     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r6.f1750d = r0     // Catch:{ NameNotFoundException | b -> 0x0063 }
            java.lang.String r0 = r5.n()     // Catch:{ NameNotFoundException | b -> 0x0063 }
            r6.e = r0     // Catch:{ NameNotFoundException | b -> 0x0063 }
            android.graphics.drawable.Drawable r0 = r6.f1749c     // Catch:{ NameNotFoundException | b -> 0x0063 }
            if (r0 == 0) goto L_0x00cc
            java.lang.String r0 = r6.f1750d     // Catch:{ NameNotFoundException | b -> 0x0063 }
            if (r0 == 0) goto L_0x00cc
            r0 = 1
            goto L_0x00cd
        L_0x00cc:
            r0 = 0
        L_0x00cd:
            r6.f1748b = r0     // Catch:{ NameNotFoundException | b -> 0x0063 }
        L_0x00cf:
            boolean r0 = r6.f1748b
            if (r0 != 0) goto L_0x00f4
            java.lang.String r0 = "preset:1"
            r6.i(r0)
            biz.obake.team.touchprotector.lfd.e r0 = biz.obake.team.touchprotector.lfd.e.d()
            android.graphics.drawable.Drawable r0 = r0.b(r4)
            r6.f1749c = r0
            biz.obake.team.touchprotector.lfd.e r0 = biz.obake.team.touchprotector.lfd.e.d()
            java.lang.String r0 = r0.c(r4)
            r6.f1750d = r0
            java.lang.String r0 = biz.obake.team.touchprotector.c.w(r2)
            r6.e = r0
            r6.f1748b = r4
        L_0x00f4:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: biz.obake.team.touchprotector.lfd.f.a():void");
    }

    public static f d() {
        if (f == null) {
            f = new f();
        }
        return f;
    }

    private void j() {
        if (this.f1749c != null) {
            this.f1749c.setAlpha((a.j("lock_frame_opacity") * 255) / 100);
        }
    }

    public void b() {
        this.f1748b = false;
    }

    public Drawable c() {
        a();
        j();
        return this.f1749c;
    }

    public String e() {
        if (this.f1747a == null) {
            this.f1747a = a.l("lock_frame_design");
        }
        return this.f1747a;
    }

    public String f() {
        a();
        return this.f1750d;
    }

    public String g() {
        a();
        return this.e;
    }

    public Drawable h() {
        String l = a.l("lock_frame_design");
        if ("preset:0".equals(l)) {
            return null;
        }
        if (l.startsWith("preset:")) {
            return e.d().b(Integer.parseInt(l.substring(7)));
        } else if (l.startsWith("custom:")) {
            return b.i().b(b.i().g(l));
        } else {
            try {
                String[] split = l.split(":", 2);
                String str = split[0];
                String str2 = split[1];
                c cVar = new c(str);
                return cVar.b(cVar.i(str2));
            } catch (PackageManager.NameNotFoundException | c.b unused) {
                return null;
            }
        }
    }

    public void i(String str) {
        a.r("lock_frame_design", str);
        this.f1747a = str;
        this.f1748b = false;
        this.f1749c = null;
        this.f1750d = null;
        this.e = null;
    }
}
